﻿/// <reference name="MicrosoftAjax.js"/>
/// <reference name="Dimok.Web.UI.JS.JQuery.VSDoc.js" assembly="Dimok.Web.UI"/>
/// <reference name="Dimok.Web.UI.JS.JQuery.Extentions.js" assembly="Dimok.Web.UI"/>
/// <reference name="Dimok.Web.UI.JS.MSAjaxExtentions.js" assembly="Dimok.Web.UI"/>
/// <reference path="../../Manager/WebServices/Common.asmx" />
/// <reference name="Dimok.Web.UI.JS.JSON_Lib.js" type="Dimok.Web.UI"/>
/// <reference path="../../Manager/Admin/Admin.asmx" />
Type.registerNamespace("motobankcorp");
motobankcorp.Bridge = function(element) {
  motobankcorp.Bridge.initializeBase(this, [element]);
}
motobankcorp.Bridge.prototype = {
  _wireEvents: function() {
    this.get_RGE().add_rowDeselected(function(sender, eventArgs) {
      sender.findPageEventsGlobal().raise_usixDeselected(eventArgs);
      sender.findPageEventsGlobal().raise_loanDeselected(eventArgs);
    });
    this.get_RGE().add_rowSelected(function(sender, eventArgs) {
      sender.findPageEventsGlobal().raise_usixSelected(eventArgs);
      delete eventArgs.get_keys().UsixID;
      delete eventArgs.get_keys().CompanyID_Raw;
      sender.findPageEventsGlobal().raise_loanSelected(eventArgs);
    });
    Dimok.FindPageEvents().add_loanSelected(Function.createDelegate(this, function(sender, eventArgs) {
      if (eventArgs.get_tableView() == this.get_MTV()) return;
      this.get_RGE().set_filterTemp("LoanID", eventArgs.get_keys().get_LoanID());
    }));
    Dimok.FindPageEvents().add_loanDeselected(Function.createDelegate(this, function(sender, eventArgs) {
      if (eventArgs.get_tableView() == this.get_MTV()) return;
      this.get_RGE().set_filterTemp("LoanID", undefined);
    }));
  },
  initialize: function() {
    motobankcorp.Bridge.callBaseMethod(this, 'initialize');
    this._wireEvents();
  },
  dispose: function() {
    motobankcorp.Bridge.callBaseMethod(this, 'dispose');
  }
}
motobankcorp.Bridge.registerClass('motobankcorp.Bridge', motobankcorp.Loans);
